package sourceagile.client;

import java.net.URI;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;

public class ListClassClient {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		URI uri = UriBuilder.fromUri(
				"http://localhost:8080/LiveSourceWebService").build();

		ClientConfig config = new DefaultClientConfig();
		Client client = Client.create(config);
		WebResource service = client.resource(uri);

		String pathURL = "https:--tictactoe4j.googlecode.com-svn-trunk-src-tictactoe-client";

		String path = "filesList/" + pathURL + "/Alline.Oliveira/bD8Km8se2rV9";

		ClientResponse response = service.path("rest").path(path)
				.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);

		System.out.println(response.getStatus());

		// Fluent interfaces
		System.out.println(response.toString());

		/*
		 * 
		 * // Fluent interfaces
		 * System.out.println(service.path("rest").path("classesList")
		 * .accept(MediaType.TEXT_PLAIN).get(ClientResponse.class) .toString());
		 * // Get plain text
		 * System.out.println(service.path("rest").path("classesList")
		 * .accept(MediaType.TEXT_PLAIN).get(String.class)); // Get XML
		 * System.out.println(service.path("rest").path("classesList")
		 * .accept(MediaType.TEXT_XML).get(String.class)); // The HTML
		 * System.out.println(service.path("rest").path("classesList")
		 * .accept(MediaType.TEXT_HTML).get(String.class));
		 */

	}

}
